\(\int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx\) [853]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 46, antiderivative size = 33 \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\frac {(c-i c \tan (e+f x))^n}{f (i-\tan (e+f x))^2} \]

[Out]

(c-I*c*tan(f*x+e))^n/f/(I-tan(f*x+e))^2

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.043, Rules used = {3669, 75} \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\frac {(c-i c \tan (e+f x))^n}{f (-\tan (e+f x)+i)^2} \]

[In]

Int[((c - I*c*Tan[e + f*x])^n*((-I)*(2 + n) + (-2 + n)*Tan[e + f*x]))/(-I + Tan[e + f*x])^2,x]

[Out]

(c - I*c*Tan[e + f*x])^n/(f*(I - Tan[e + f*x])^2)

Rule 75

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[b*(c + d*x)^
(n + 1)*((e + f*x)^(p + 1)/(d*f*(n + p + 2))), x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && NeQ[n + p + 2, 0] &
& EqQ[a*d*f*(n + p + 2) - b*(d*e*(n + 1) + c*f*(p + 1)), 0]

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {(i c) \text {Subst}\left (\int \frac {(c-i c x)^{-1+n} (-i (2+n)+(-2+n) x)}{(-i+x)^3} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(c-i c \tan (e+f x))^n}{f (i-\tan (e+f x))^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 5.45 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.94 \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\frac {(c-i c \tan (e+f x))^n}{f (-i+\tan (e+f x))^2} \]

[In]

Integrate[((c - I*c*Tan[e + f*x])^n*((-I)*(2 + n) + (-2 + n)*Tan[e + f*x]))/(-I + Tan[e + f*x])^2,x]

[Out]

(c - I*c*Tan[e + f*x])^n/(f*(-I + Tan[e + f*x])^2)

Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 91 vs. \(2 (31 ) = 62\).

Time = 0.74 (sec) , antiderivative size = 92, normalized size of antiderivative = 2.79

method result size
derivativedivides \(\frac {\frac {\tan \left (f x +e \right )^{2} {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}-\frac {{\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}+\frac {2 i \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}}{\left (1+\tan \left (f x +e \right )^{2}\right )^{2}}\) \(92\)
default \(\frac {\frac {\tan \left (f x +e \right )^{2} {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}-\frac {{\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}+\frac {2 i \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f}}{\left (1+\tan \left (f x +e \right )^{2}\right )^{2}}\) \(92\)

[In]

int((c-I*c*tan(f*x+e))^n*(-I*(2+n)+(-2+n)*tan(f*x+e))/(-I+tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

(1/f*tan(f*x+e)^2*exp(n*ln(c-I*c*tan(f*x+e)))-1/f*exp(n*ln(c-I*c*tan(f*x+e)))+2*I/f*tan(f*x+e)*exp(n*ln(c-I*c*
tan(f*x+e))))/(1+tan(f*x+e)^2)^2

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.64 \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=-\frac {\left (\frac {2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n} {\left (e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{4 \, f} \]

[In]

integrate((c-I*c*tan(f*x+e))^n*(-I*(2+n)+(-2+n)*tan(f*x+e))/(-I+tan(f*x+e))^2,x, algorithm="fricas")

[Out]

-1/4*(2*c/(e^(2*I*f*x + 2*I*e) + 1))^n*(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1)*e^(-4*I*f*x - 4*I*e)/
f

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 66 vs. \(2 (24) = 48\).

Time = 0.64 (sec) , antiderivative size = 66, normalized size of antiderivative = 2.00 \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\begin {cases} \frac {\left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f \tan ^{2}{\left (e + f x \right )} - 2 i f \tan {\left (e + f x \right )} - f} & \text {for}\: f \neq 0 \\\frac {x \left (\left (n - 2\right ) \tan {\left (e \right )} - i \left (n + 2\right )\right ) \left (- i c \tan {\left (e \right )} + c\right )^{n}}{\left (\tan {\left (e \right )} - i\right )^{2}} & \text {otherwise} \end {cases} \]

[In]

integrate((c-I*c*tan(f*x+e))**n*(-I*(2+n)+(-2+n)*tan(f*x+e))/(-I+tan(f*x+e))**2,x)

[Out]

Piecewise(((-I*c*tan(e + f*x) + c)**n/(f*tan(e + f*x)**2 - 2*I*f*tan(e + f*x) - f), Ne(f, 0)), (x*((n - 2)*tan
(e) - I*(n + 2))*(-I*c*tan(e) + c)**n/(tan(e) - I)**2, True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((c-I*c*tan(f*x+e))^n*(-I*(2+n)+(-2+n)*tan(f*x+e))/(-I+tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: THROW: The catch RAT-ERR is undefined.

Giac [F]

\[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\int { \frac {{\left ({\left (n - 2\right )} \tan \left (f x + e\right ) - i \, n - 2 i\right )} {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n}}{{\left (\tan \left (f x + e\right ) - i\right )}^{2}} \,d x } \]

[In]

integrate((c-I*c*tan(f*x+e))^n*(-I*(2+n)+(-2+n)*tan(f*x+e))/(-I+tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate(((n - 2)*tan(f*x + e) - I*n - 2*I)*(-I*c*tan(f*x + e) + c)^n/(tan(f*x + e) - I)^2, x)

Mupad [B] (verification not implemented)

Time = 8.46 (sec) , antiderivative size = 90, normalized size of antiderivative = 2.73 \[ \int \frac {(c-i c \tan (e+f x))^n (-i (2+n)+(-2+n) \tan (e+f x))}{(-i+\tan (e+f x))^2} \, dx=\frac {{\left (-\frac {c\,\left (-2\,{\cos \left (e+f\,x\right )}^2+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )}{2\,{\cos \left (e+f\,x\right )}^2}\right )}^n\,\left (-4\,{\cos \left (e+f\,x\right )}^2-2\,{\cos \left (2\,e+2\,f\,x\right )}^2+\sin \left (2\,e+2\,f\,x\right )\,2{}\mathrm {i}+\sin \left (4\,e+4\,f\,x\right )\,1{}\mathrm {i}+2\right )}{4\,f} \]

[In]

int(-((c - c*tan(e + f*x)*1i)^n*(n*1i - tan(e + f*x)*(n - 2) + 2i))/(tan(e + f*x) - 1i)^2,x)

[Out]

((-(c*(sin(2*e + 2*f*x)*1i - 2*cos(e + f*x)^2))/(2*cos(e + f*x)^2))^n*(sin(2*e + 2*f*x)*2i + sin(4*e + 4*f*x)*
1i - 2*cos(2*e + 2*f*x)^2 - 4*cos(e + f*x)^2 + 2))/(4*f)